<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: tableHeader('文档列表')" />
</head>
<body>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="user-form">
                <div class="select-list">
                    <ul>
                        <li>
                            标题：<input type="text" name="title"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
    </div>

</div>

<div class="btn-group-sm" id="toolbar" role="group">
    <a class="btn btn-success" onclick="$.operate.getContent('1')">
        <i class="fa fa-plus"></i> 新增
    </a>
</div>

<div class="col-sm-12 select-table table-striped">
    <table id="bootstrap-table" data-mobile-responsive="true"></table>
</div>

<th:block th:include="include :: tableFooter" />
<script th:inline="javascript">
    var prefix = "/documentation";

    $(function() {
        var options = {
            url: prefix + "/list",
            modalName : "文档",
            width :1200,
            height :800,
            addUrl :prefix+"/add",
            editUrl :prefix+"/edit",
            removeUrl :prefix+"/remove",
            columns : [{
                checkbox: true
            },
                {
                    field : 'id',
                    title : '序号',
                    align: 'center',

                },
                {
                    field : 'title',
                    title : '文档名称',
                    align: 'center',
                },
                {
                    field: 'createTime',
                    title: '创建时间',
                    align: 'center',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.getContent(\'2\',\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="details(\'' + row.id + '\')"><i class="fa fa-plus"></i>查看</a> ');
                        actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function details(id) {
        var index = layer.open({
                type: 2,
                fix: true,
                maxmin: true,
                shade: 0.3,
                title: "文档详情",
                content: prefix+"/details?id="+id,
                // 弹层外区域关闭
                shadeClose: true
            });
        layer.full(index);
    }
</script>
</body>
</html>